<template>
    <div class="epsInfoWrap">
      <el-row>
        <el-form
            :inline="true"
            :model="searchParams"
            style="width: 100%"
            size="small"
            class="formInline"
        >
          <el-form-item label="商品及服务编码：" style="max-width: 340px">
            <el-input
                style="width: 160px"
                v-model="searchParams.gstcmCode"
            ></el-input>
          </el-form-item>
          <el-form-item label="商品和服务名称：" style="max-width: 340px">
            <el-input
                style="width: 160px"
                v-model="searchParams.sphfwmc"
            ></el-input>
          </el-form-item>
          <el-form-item label="企业商品及服务编码：" style="max-width: 340px">
            <el-input
                style="width: 160px"
                v-model="searchParams.epsCode"
            ></el-input>
          </el-form-item>
          <el-form-item label="企业商品及服务名称：" style="max-width: 340px">
            <el-input
                style="width: 160px"
                v-model="searchParams.epsName"
            ></el-input>
          </el-form-item>
  
  
          <el-form-item
          >
            <el-button @click="onSubmit" type="primary">查询</el-button>
            <el-button @click="onResize">重置</el-button>
          </el-form-item>
        </el-form>
      </el-row>

      <tableList
          border
          :heightMin="160"
          :keySet="keySet"
          :tableData="listDetails"
          :paginationShow="true"
          :pageNumber="pages.current"
          :pageSize="pages.size"
          :total="pages.total"
          :radioSelect="true"
          @radioHandleCurrentChange="radioHandleCurrentChange"
          @handleSizeChange="handleSizeChange"
          @rowClick="rowClick"
          @handleCurrentChange="handleCurrentChange"
          @rowDblclick="dbClick"
      >
      </tableList>
  
    </div>
  
  </template>
    
    <script>
  
  import DictSelect from "@/views/invoiceTemplate/components/DictSelect/DictSelect.vue";
  import tableList from "@/components/tableList/index.vue";
  import { queryForHandle } from '@/api/vmsEpsInformation.js'
  import mixinTable from "@/mixin/mtable";
  
  
  export default {
      name: 'projectListCompNew',
      components:{
        tableList,
        DictSelect
      },
      props:{
        tdys:{
          type: String,
          default:'',
        },
        cezslxdm:{
          type: String,
          default: false,
        },
        fpzl:{
          type: String,
          default:'',
        },
      },
      mixins: [mixinTable],
      mounted(){
        this.onResize()
        this.getList()
      },
      data() {
          return {
            loading: false,
            listDetails: [],
            keySet: [
              {
                label: '企业商品及服务编码',
                englishName: 'epsCode',
                width: '200px'
              },
              {
                label: '企业商品及服务名称',
                englishName: 'epsName',
                width: '200px'
              },
              {
                label: '父级编码',
                englishName: 'parentCode',
                width: '100px'
              },
              {
                label: '商品及服务编码',
                englishName: 'gstcmCode',
                width: 170
              },
              {
                label: '商品和服务名称',
                englishName: 'sphfwmc',
                width: 300
              },
              {
                label: '商品和服务分类简称',
                englishName: 'sphfwfljc',
                width: '200px'
              },
              {
                label: '税率',
                englishName: 'zzssl',
                width: '80px'
              },
              {
                label: '计量单位',
                englishName: 'jldwText',
                width: '80px'
              },
              {
                label: '优惠政策标识',
                englishName: 'yhzcbsText',
                width: '140px'
              },
              {
                label: '计税方法',
                englishName: 'jsffText',
                width: '80px'
              },
              {
                label: '征税项目',
                englishName: 'zsxmText',
                width: '80px'
              },
              {
                label: '启用日期',
                englishName: 'qyrq',
                width: '200px'
              },
              {
                label: '停用日期',
                englishName: 'tyrq',
                width: '200px'
              },
  
            ],
            selectRow:null,
          }
      },
      methods:{
        dbClick(){
          this.$emit("submitSearch")
        },
        /**
         * 查询列表数据
         * @param params
         * @returns {Promise<void>}
         */
        async getList() {
          let {data, code, message} = await queryForHandle({
              gstcmCode: this.searchParams.gstcmCode,
              sphfwmc: this.searchParams.sphfwmc,
              epsName: this.searchParams.epsName,
              epsCode: this.searchParams.epsCode,
              pageNo: this.pages.current,
              pageSize: this.pages.size,

              fpzl: this.fpzl,
              tdyslxdm: this.tdys,
              cezs: this.cezslxdm 
            })
  
          if (code == 200) {
            this.loading = false
            this.listDetails = data.records.map(item=>{
                                return {
                                    ...item
                                }
                            })
            this.pages.total = data.total
            this.pages.current = data.current
            this.pages.size = data.size
          } else {

          }
  
        },
        /**
         * 重置参数
         */
         onSubmit() {
          this.pages.current = 1;
          this.getList()
        },
        onResize() {
          this.onResizeFn()
        },

        rowClick(val){
            console.log(val);
            this.$emit("rowClick",val)
        },
        // 单选
        radioHandleCurrentChange(val) {
          this.selectRow = val
        },
      }
  }
  </script>
  
    <style lang = "scss" scoped>
    @import '@/style/variables.scss';
    .epsInfoWrap {
      box-sizing: border-box;
      .head {
        display: flex;
        height: 18px;
        align-items: center;
        margin-bottom: 4px;
        margin-top: 4px;
  
        .colCLas {
          width: 4px;
          height: 100%;
          background-color: $allBg;
          margin-right: 12px;
        }
  
        .info {
          height: 100%;
          display: flex;
          align-items: center;
        }
      }
  
    }
  </style>
    